package com.longlong.test;

import com.longlong.pojo.Student;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @Author DELL longlong
 * @Date 2022/7/3 19:32
 * @Version 1.0
 * @Function
 */
public class Mytest {
   @Test
    public void testGetAll() throws IOException {
       InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml");
       SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(in);
       SqlSession sqlSession = factory.openSession();
       List<Student> list = sqlSession.selectList("ll.getAll");
       list.forEach(user -> System.out.println(user));
       System.out.println("OK");
      sqlSession.close();
   }
}
